clc;
clear;


% 说明，其实求解加速器的值不至于要放入函数求，因为每用一次就要求一下a，但其实
%很多时候都在用一个a值，那还不如直接外部计算a后传值进去
t_acc = 1;
t_ed = 3;
pos_st = 0.1;
pos_ed = 0.15;
pos_final = @(a)(a*t_acc^2+t_acc*(t_ed-2*t_acc)*a-pos_ed+pos_st);
a_value = fsolve(pos_final,0);

period = 0.01;
steps = t_ed/period+1;
pos_s_traj_value = position_s_traj_info(a_value,t_acc,t_ed,period,pos_st);

t = 0:period:t_ed;
subplot(3,1,1);
plot(t,pos_s_traj_value(:,1));
title("position");
subplot(3,1,2);
plot(t,pos_s_traj_value(:,2));
title("velocity");
subplot(3,1,3);
plot(t,pos_s_traj_value(:,3));
title("acc");